package beans;

import entities.OrdenesDetalle;
import controllers.OrdenesDetalleFacade;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean(name = "ordenesDetalleController")
@ViewScoped
public class OrdenesDetalleController extends AbstractController<OrdenesDetalle> implements Serializable {

    @EJB
    private OrdenesDetalleFacade ejbFacade;

    public OrdenesDetalleController() {
        super(OrdenesDetalle.class);
    }

    @PostConstruct
    public void init() {
        super.setFacade(ejbFacade);
    }

    @Override
    protected void setEmbeddableKeys() {
        this.getSelected().getOrdenesDetallePK().setCodCliente(this.getSelected().getClientes().getCodCliente());
    }

    @Override
    protected void initializeEmbeddableKey() {
        this.getSelected().setOrdenesDetallePK(new entities.OrdenesDetallePK());
    }
}
